package com.example.lab02.dao;

import com.example.lab02.entity.User;
import jakarta.transaction.Transactional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface UserDao extends JpaRepository<User, Integer>, PagingAndSortingRepository<User,Integer> {
    @Transactional
    @Modifying
    @Query(value = "insert into lab02.user value (null,:#{username} , md5(:#{#user.password}))", nativeQuery = true)
    void create(User user);
}
